<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    li{ cursor: pointer;
        display: flex;
        width: 100px;
        justify-content: center;
        align-items: center;
        height: 50px;

        font-size: 20px;
        font-weight: 700;
    }
    ul{
        display: flex;
        border-bottom: 2px solid red;
    }
    .active{
        background-color: red;
        color: aliceblue;
    }
</style>
<body>
    <div id="app">
     <ul>
        <li   v-for="(item,index) in list" @click="fu(item.id)" :key="item.id" :class="{active:acyiveIndex===item.id}">{{item.name}}</li>
     </ul>
    </div>
</body>
<script>
   const app=new Vue({
    el:'#app',
    data:{
        acyiveIndex:0,
        list:[
            {id:1,name:'京东秒杀'},
            {id:2,name:'每日特价'},
            {id:3,name:'品类秒杀'},
        ],
       
    },
    methods: {
            fu(id){
            this.acyiveIndex=id,
            console.log(id)
            }
        }
   })
</script>
</html>